package com.codrim.cs.data.server.dao.param;

import com.codrim.cs.data.rpc.dto.param.AffiliateWholeDayDataParamDTO;
import com.codrim.cs.data.server.utils.DateUtils;

import org.apache.commons.lang3.math.NumberUtils;

import java.util.List;

import lombok.Data;

/**
 * @author Liang.Zhuge
 * @date 07/03/2018
 */
@Data
public class AffAllParam {
    /**
     * 公司ID
     */
    private Integer companyId;

    /**
     * 要查询的日期,生效的只有日期
     */
    private Integer date;

    private List<Integer> departmentIds;
    private Integer advertiserManagerId;

    public static AffAllParam of(AffiliateWholeDayDataParamDTO dto) {
        AffAllParam param = new AffAllParam();
        param.setCompanyId(dto.getCompanyId());
        param.setDate(NumberUtils.toInt(DateUtils.toString(dto.getDate(), "yyyyMMdd", dto.getZone())));
        param.setDepartmentIds(dto.getDepartmentIds());
        param.setAdvertiserManagerId(dto.getAdvertiserManagerId());
        return param;
    }
}
